package com.zking.service.impl.ly;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

import com.zking.service.ly.EmailsService;

@Service
public class EmailsServiceImpl implements EmailsService{
	@Autowired
    private JavaMailSender js;
	
	@Value("${spring.mail.username}")
    private String from;

	@Override
	public void sendSimpleMail(String to, String subject, String content) {
		SimpleMailMessage messages = new SimpleMailMessage();
		messages.setFrom(from); // 邮件发送者
		messages.setTo(to); // 邮件接受者
		messages.setSubject(subject); // 主题
		messages.setText(content); // 内容
        js.send(messages);
	}
}
